<?php 
$content = '';
foreach($_GET['add'] as $addItem) {
	if ($addItem == 'jTab')
		$content .= "if ($('div.tabs').length > 0) $('div.tabs').tabs();\n";
	
	if ($addItem == 'jScroll') 
		$content .= 
			"$('a[href^=#]').on('click', function(e){
				var href = $(this).attr('href').substr(1);
				if ($('[name='+href+']').length > 0) {
					$('html, body').animate({scrollTop:$('[name='+href+']').offset().top} ,'slow');
					e.preventDefault(); 
				}
			});\n";
	}
	
	if ($addItem == 'popuplayer')
		$content .= 
		 "$('input.button_popup_layer').popuplayer();
			$('.container_popup_layer .btn_close').click(function() {
				$('.container_popup_layer').fadeOut(300);
				return false;
			});\n";
	
if ($content != '')
	$content = "$(document).ready(function(){\n".$content."});\n";
